/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

/**
 *
 * @author Lyuda
 */
import java.util.Scanner;

public class HandlerInputOutput implements InputOutputInterface {

    private Scanner scanner;

    public HandlerInputOutput() {
        scanner = new Scanner(System.in);
    }

    @Override
    public void print(String outputString) {
        System.out.println(outputString);
    }

    @Override
    public int[] readAnswer() {
        return convertInputDataIntoDigit(scanner.next());
    }

    private int[] convertInputDataIntoDigit(String input) {
        String[] answers = input.split(",");
        int[] result = new int[answers.length];
        for (int numberOfAnswer = 0; numberOfAnswer < answers.length; numberOfAnswer++) {
            result[numberOfAnswer] = Integer.parseInt(answers[numberOfAnswer]);
        }
        return result;
    }
}
